﻿<ContentControl x:Class="FacebookClient.LoginPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ClientManagerControls="clr-namespace:ClientManager.Controls"
    xmlns:FacebookClient="clr-namespace:FacebookClient">
  <Grid Background="#88000000">
    <Border x:Name="ErrorBorder"
        Visibility="Collapsed"
        Margin="40, 0"
        BorderThickness="4" 
        CornerRadius="0" 
        BorderBrush="Maroon" Background="White" VerticalAlignment="Center" HorizontalAlignment="Center">
      <StackPanel Orientation="Vertical">
        <TextBlock x:Name="ErrorText"
            TextWrapping="Wrap"
            TextTrimming="WordEllipsis"
            Margin="20"
            FontWeight="Light"
            FontFamily="{DynamicResource SansSerifFont}"
            Foreground="Maroon"
            FontSize="{DynamicResource LargeFontSize2}"
            Text=""
            TextAlignment="Center"
            VerticalAlignment="Stretch" 
            HorizontalAlignment="Stretch"/>
        <Button x:Name="TryAgainButton"
            Style="{DynamicResource StandardButtonStyle}"
            Margin="10" 
            HorizontalAlignment="Right" 
            Click="_OnTryAgain">Try again</Button>
      </StackPanel>
    </Border>

    <!-- This is made to look like the loading page, so we don't want the Grid background to show through. -->
    <Border x:Name="InformationBorder"
        VerticalAlignment="Stretch"
        HorizontalAlignment="Stretch"
        Visibility="Collapsed"
        Background="White">
      <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
        <TextBlock x:Name="InformationText"
            TextWrapping="Wrap"
            TextTrimming="WordEllipsis"
            Margin="20"
            FontWeight="Light"
            FontFamily="{DynamicResource SansSerifFont}"
            Foreground="{DynamicResource FacebookBlueBrush}"
            FontSize="{DynamicResource LargeFontSize4}"
            Text=""
            TextAlignment="Center"
            VerticalAlignment="Stretch" 
            HorizontalAlignment="Stretch"/>
        <TextBlock Foreground="{DynamicResource FacebookBlueBrush}" FontFamily="{DynamicResource SansSerifFont}" FontWeight="Light" Opacity="1" FontSize="{DynamicResource MiddleFontSize}" HorizontalAlignment="Center" Margin="0,5,0,0" Text="Please wait" />
        <ClientManagerControls:Spinner Margin="0,20,0,0" Foreground="{DynamicResource FacebookBlueBrush}">
          <ClientManagerControls:Spinner.Style>
            <Style TargetType="{x:Type ClientManagerControls:Spinner}">
              <Setter Property="IsRunning" Value="False" />
              <Style.Triggers>
                <DataTrigger Binding="{Binding ElementName=InformationText, Path=Visibility}" Value="Visible">
                  <Setter Property="IsRunning" Value="True" />
                </DataTrigger>
              </Style.Triggers>
            </Style>
          </ClientManagerControls:Spinner.Style>
        </ClientManagerControls:Spinner>
      </StackPanel>
    </Border>

    <Border x:Name="LoginBorder"
            Margin="0" 
            BorderThickness="4" 
            CornerRadius="0" 
            BorderBrush="{DynamicResource FacebookBlueBrush}" 
            Background="{DynamicResource FacebookBlueBrush}" 
            MaxWidth="600" MaxHeight="450"
            HorizontalAlignment="Center" 
            VerticalAlignment="Center">
      <DockPanel>
        <CheckBox DockPanel.Dock="Bottom"
            Margin="2"
            Foreground="White"
            IsChecked="{Binding Source={x:Static FacebookClient:FacebookClientApplication.Current}, Path=KeepMeLoggedIn}">Keep me logged into Fishbowl.</CheckBox>
        <WebBrowser x:Name="LoginBrowser" Navigated="_OnBrowserNavigated" />
      </DockPanel>
    </Border>
  </Grid>
</ContentControl>
